var express = require('express');
var router = express.Router();

const UserModel = require('../db/UserModel');

/* GET users listing. */
router.get('/save', function (req, res, next) {
  // 获取条件
  const user = new UserModel({ name: 'lidongxue' });
  user.save().then(() => {
   return res.json({code:200,mes:'保存成功'});
  }
  ).catch(() => {
     return res.json({code:201,mes:'保存失败'})
  });
});
router.get('/delete', function (req, res, next) {
  res.send('respond delete');

});
router.get('/update', function (req, res, next) {
  res.send('respond update');

});
router.get('/findlist', function (req, res, next) {
  res.send('respond findlist');

});
router.get('/findone', function (req, res, next) {
  res.send('respond findone');

});
module.exports = router;
